package com.zhongyu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongyu.pojo.Order;
import com.zhongyu.pojo.OrderDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

public interface OrderDetailMapper extends BaseMapper<OrderDetail> {
    @Select("select * from smbms_order_detail where order_id=#{id}")
    List<OrderDetail> selectId(Integer id);
@Select("SELECT * FROM smbms_order_detail WHERE id=#{id}")
    OrderDetail selectRu(Integer id);
@Select("SELECT * FROM smbms_order_detail WHERE order_id=(SELECT order_id FROM smbms_order_detail WHERE id=#{id}) AND state=0")
  Integer  selectMing(@Param("id")Integer Id) ;
    @Select("SELECT * FROM smbms_order_detail WHERE id=#{id}")
    OrderDetail selectOut(Integer id);
    @Select("SELECT * FROM smbms_order_detail WHERE order_id=(SELECT order_id FROM smbms_order_detail WHERE id=#{id}) AND state=0")
    Integer  selectXian(@Param("id")Integer Id) ;
    @Select("UPDATE smbms_order_detail SET state=#{state} ,end_time=#{endtime},stock_keeper=#{stockeeper},store_id=#{storeId} where id=#{id} ")
    void update( @Param("state") Integer state, @Param("stockeeper") Integer stockKeeper,@Param("storeId") Integer storeId, @Param("endtime") LocalDateTime endtime,@Param("id") Integer id);
}
